package com.skd.mall.search.controller;


import com.skd.mall.search.service.MallSearchService;
import com.skd.mall.search.vo.SearchParam;
import com.skd.mall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class SearchController {

    @Autowired
    private MallSearchService mallSearchService;

    @RequestMapping(value = {"/list.html", "/","/index.html"})
    public String listPage(SearchParam param, Model model){
        SearchResult searchResult = mallSearchService.search(param);
        model.addAttribute("result",searchResult);
        return "index";
    }

}
